<?php

/**
 * This is the model class for table "main_stairway".
 *
 * The followings are the available columns in table 'main_stairway':
 * @property integer $id
 * @property string $width
 * @property string $units_of_measurement_of_the_width
 * @property string $construction
 * @property integer $railing_provided
 * @property string $rp_made_of
 * @property integer $enclosure_provided
 * @property string $enclosure_construction
 * @property integer $any_opening
 * @property string $fire_door_construction
 * @property integer $door_equipped_with_self_closing_device
 * @property integer $door_proper_rating
 * @property integer $door_provided_with_vision_panel
 * @property string $if_yes_made_of
 * @property integer $door_swing_in_the_direction_of_exit_travel
 * @property string $stairway_pressurized
 * @property string $pressurized_type_or_method
 * @property string $date_last_tested
 * @property integer $exit_detail_id
 *
 * The followings are the available model relations:
 * @property ExitDetail $exitDetail
 */
class MainStairway extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return MainStairway the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
	
const a = "Yes";
const b ="No";
const c ="N/A";
public function getStairway_pressurized(){
return array(
self::a=>"Yes",
self::b=>"No",
self::c=>"N/A"
);


}
const d = "Foot";
const e ="Inches";
public function getMeasurement(){
return array(
self::d=>"Foot",
self::e=>"Inches"
);


}
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'main_stairway';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('exit_detail_id', 'required'),
			array('railing_provided, enclosure_provided, any_opening, door_equipped_with_self_closing_device, door_proper_rating, door_provided_with_vision_panel, door_swing_in_the_direction_of_exit_travel, exit_detail_id', 'numerical', 'integerOnly'=>true),
			array('width', 'length', 'max'=>11),
			array('units_of_measurement_of_the_width', 'length', 'max'=>6),
			array('stairway_pressurized', 'length', 'max'=>3),
			array('construction, rp_made_of, enclosure_construction, fire_door_construction, if_yes_made_of, pressurized_type_or_method, date_last_tested', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, width, units_of_measurement_of_the_width, construction, railing_provided, rp_made_of, enclosure_provided, enclosure_construction, any_opening, fire_door_construction, door_equipped_with_self_closing_device, door_proper_rating, door_provided_with_vision_panel, if_yes_made_of, door_swing_in_the_direction_of_exit_travel, stairway_pressurized, pressurized_type_or_method, date_last_tested, exit_detail_id', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'exitDetail' => array(self::BELONGS_TO, 'ExitDetail', 'exit_detail_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'width' => 'Width',
			'units_of_measurement_of_the_width' => 'Units Of Measurement Of The Width',
			'construction' => 'Construction',
			'railing_provided' => 'Railing Provided',
			'rp_made_of' => 'Rp Made Of',
			'enclosure_provided' => 'Enclosure Provided',
			'enclosure_construction' => 'Enclosure Construction',
			'any_opening' => 'Any Opening',
			'fire_door_construction' => 'Fire Door Construction',
			'door_equipped_with_self_closing_device' => 'Door Equipped With Self Closing Device',
			'door_proper_rating' => 'Door Proper Rating',
			'door_provided_with_vision_panel' => 'Door Provided With Vision Panel',
			'if_yes_made_of' => 'If Yes Made Of',
			'door_swing_in_the_direction_of_exit_travel' => 'Door Swing In The Direction Of Exit Travel',
			'stairway_pressurized' => 'Stairway Pressurized',
			'pressurized_type_or_method' => 'Pressurized Type Or Method',
			'date_last_tested' => 'Date Last Tested',
			'exit_detail_id' => 'Exit Detail',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('width',$this->width,true);
		$criteria->compare('units_of_measurement_of_the_width',$this->units_of_measurement_of_the_width,true);
		$criteria->compare('construction',$this->construction,true);
		$criteria->compare('railing_provided',$this->railing_provided);
		$criteria->compare('rp_made_of',$this->rp_made_of,true);
		$criteria->compare('enclosure_provided',$this->enclosure_provided);
		$criteria->compare('enclosure_construction',$this->enclosure_construction,true);
		$criteria->compare('any_opening',$this->any_opening);
		$criteria->compare('fire_door_construction',$this->fire_door_construction,true);
		$criteria->compare('door_equipped_with_self_closing_device',$this->door_equipped_with_self_closing_device);
		$criteria->compare('door_proper_rating',$this->door_proper_rating);
		$criteria->compare('door_provided_with_vision_panel',$this->door_provided_with_vision_panel);
		$criteria->compare('if_yes_made_of',$this->if_yes_made_of,true);
		$criteria->compare('door_swing_in_the_direction_of_exit_travel',$this->door_swing_in_the_direction_of_exit_travel);
		$criteria->compare('stairway_pressurized',$this->stairway_pressurized,true);
		$criteria->compare('pressurized_type_or_method',$this->pressurized_type_or_method,true);
		$criteria->compare('date_last_tested',$this->date_last_tested,true);
		$criteria->compare('exit_detail_id',$this->exit_detail_id);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}